﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IHISCETeim.DAL;
using IHISCETeim.Model;
using IHISCETeim.Library;
using System.Data;
namespace IHISCETeim.BLL
{
    public class U4008RecordController : BaseController
    {
        public static int Add(U4008RecordInfo obj)
        {
            int x = U4008RecordDAL.Add(obj);
            if (x > 0)
            {
                OUserInfo obju = OUserController.GetByUserName(obj.UserName);
                if (!obju.Mobile.IsEmptyOrNull())
                {
                    string smscontent = string.Format("{0}有用户来电.机号[{1}]问题:{2}[石川岛中骏]",obju.RealName,obj.SerialNumber,obj.Problemdescription) ;
                    smscontent = smscontent.Replace(",","，");
                    SMSProccessController.Add("用户来电400", obj.UserName, smscontent);
                }
            }
            return x;
        }
        public static bool Delete(int U4RID)
        {
            return U4008RecordDAL.Delete(U4RID);
        }
        public static U4008RecordInfo GetByU4RID(int U4RID)
        {
            U4008RecordInfo obj =CBO.FillObject<U4008RecordInfo>( U4008RecordDAL.GetByU4RID(U4RID));
            if (obj == null)
                return new U4008RecordInfo();
            return obj;
        }
        public static DataTable GetPagination(string URType, string RealName, string SerialNumber, string CustomerName, string AgentName,int IsComplete, string CallDateFrom, string CallDateTo, int PageIndex, int PageSize, string Sort, ref int TotalCount)
        {
            return U4008RecordDAL.GetPagination(URType, RealName, SerialNumber, CustomerName, AgentName,IsComplete, CallDateFrom, CallDateTo, PageIndex, PageSize, Sort, ref  TotalCount);
        }
        public static bool Update(U4008RecordInfo obj)
        {
            return U4008RecordDAL.Update(obj);
        }
        public static bool UpdateReplay(int U4RID, string ReplayRemark, bool IsComplete)
        {
            return U4008RecordDAL.UpdateReplay(U4RID, ReplayRemark, IsComplete);
        }
        /// <summary>
        /// 获取技师处理统计报表
        /// </summary>
        /// <param name="fromdate"></param>
        /// <param name="todate"></param>
        /// <returns></returns>
        public static DataTableCollection GetToJiReport(string fromdate, string todate)
        {
            return U4008RecordDAL.GetToJiReport(fromdate, todate);
        }
    }
}
